export const DEBUG: boolean = import.meta.env.VITE_DEBUG ? true : false
export const APP_NAME: string = import.meta.env.VITE_APP_NAME
  ? String(import.meta.env.VITE_APP_NAME)
  : ''
export const API_ENDPOINT: string = import.meta.env.VITE_API_ENDPOINT
  ? String(import.meta.env.VITE_API_ENDPOINT)
  : 'COURSES'
export const VITE_PROXY_TARGET: string = import.meta.env.VITE_PROXY_TARGET
  ? String(import.meta.env.VITE_PROXY_TARGET)
  : 'COURSES'
export const PASSWORD_MIN_LENGTH: number = import.meta.env.PASSWORD_MIN_LENGTH
  ? parseInt(String(import.meta.env.PASSWORD_MIN_LENGTH), 10)
  : 7
export const PASSWORD_MAX_LENGTH: number = import.meta.env.PASSWORD_MAX_LENGTH
  ? parseInt(String(import.meta.env.PASSWORD_MAX_LENGTH), 10)
  : 32
export const VITE_LANGUAGE_SESSION_NAME: string =
  (import.meta.env.VITE_LANGUAGE_SESSION_NAME as string) || 'local_language'
export const CAN_CHANGE_LANGUAGE: boolean = import.meta.env
  .VITE_LANGUAGE_CAN_CHANGE
  ? true
  : false
export const VITE_LOCALE_LANGUAGE: string =
  (import.meta.env.VITE_LOCALE_LANGUAGE as string) || 'en'
export const VITE_GUACAMOLE_TUNNEL_WS_PATH: string =
  (import.meta.env.VITE_GUACAMOLE_TUNNEL_WS_PATH as string) || ''
export const VITE_DELETE_SESSION_BY_STOP =
  import.meta.env.VITE_DELETE_SESSION_BY_STOP || false
export const VITE_ISSO_URL = import.meta.env.VITE_ISSO_URL
  ? String(import.meta.env.VITE_ISSO_URL)
  : undefined
//站点配置
export const LOGO: string = String(import.meta.env.VITE_LOGO) || ''
export const FOOTER_LOGO: string =
  String(import.meta.env.VITE_FOOTER_LOGO) || ''
export const TITLE: string =
  String(import.meta.env.VITE_TITLE) || sessionStorage.getItem('head') || ''
export const BANNER: string = String(import.meta.env.VITE_BANNER) || ''
export const HOME_DESCRIPTION: string =
  String(import.meta.env.VITE_HOME_DESCRIPTION) || ''
export const HOME_DESCRIPTION_EN: string =
  String(import.meta.env.VITE_HOME_DESCRIPTION_EN) || ''

export const VITE_COMMENT = import.meta.env.VITE_COMMENT ? true : false
export const WS_URL = import.meta.env.VITE_WS_URL
  ? (import.meta.env.VITE_WS_URL as string)
  : ''
export const RATIO: number = import.meta.env.VITE_RATIO
  ? parseInt(import.meta.env.VITE_RATIO as string)
  : 3
//平台模式
export const PLATFORM: string = import.meta.env.VITE_PLATFORM
  ? (import.meta.env.VITE_PLATFORM as string)
  : 'course'

//docker 网卡名称
export const DOCKER_NETWORK_NAME =
  import.meta.env.VITE_DOCKER_NETWORK_NAME ?? 'bridge'
const variableName = [
  'VITE_APP_NAME',
  'VITE_TITLE',
  'VITE_API_ENDPOINT',
  'VITE_PROXY_TARGET',
  'VITE_USERNAME_MIN_LENGTH',
  'VITE_USERNAME_MAX_LENGTH',
  'VITE_PASSWORD_MIN_LENGTH',
  'VITE_PASSWORD_MAX_LENGTH',
  'VITE_LANGUAGE_SESSION_NAME',
  'VITE_LOCALE_LANGUAGE',
  'VITE_GUACAMOLE_TUNNEL_WS_PATH',
  //删除session时，停止实例。 true 停止，false 销毁
  'VITE_DELETE_SESSION_BY_STOP',
  'VITE_DEBUG',
  'VITE_ISSO_URL',
  'VITE_COMMENT',
]

DEBUG &&
  console.log(
    Object.fromEntries(variableName.map((key) => [key, import.meta.env[key]]))
  )
